<template>
  <div id="goodsall" class="modifygoods">
    <el-row>
      <el-col :span="24">
        <div class="modifywrap">
          <div class="panel">
            <div class="panel-header">
              <h3 class="title">修改分类</h3>
            </div> 
            <div class="goodsdetail-item">
              <span class="label">分类ID:</span>
              <el-input
                type="text"
                disabled
                v-model="categoryId">
              </el-input>
             
            </div>
            <div class="goodsdetail-item">
              <span class="label">分类名称:</span>
              <el-input
                type="textarea"
                autosize
                placeholder="请输入内容"
                v-model="categoryName">
              </el-input>
            </div>
             <div class="goodsdetail-item">
                <span class="label f0">确认修改</span>
                <el-button type="primary" class="fl" @click="saveModify">确认修改</el-button>
             </div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
  import axios from 'axios'
  export default{
    name: 'newsForm',
    data () {
      return {
        categoryId: this.$route.params.id,
        categoryName: this.$route.params.categoryName
      }
    },
    components: {
    },
    created () {
      console.log(this.$route.params)
      axios({
          url: 'http://47.90.38.178:8080/wx_shop_test/manage/category/set_category_name.do',
          method: 'POST',
          params: {
            productId: this.$route.params.id
          }
        }).then(obj => {
          if (obj.data.status === 0) {
            console.log('x')
            this.productInfo = obj.data.data
            console.log(obj.data.list)
          }
        })
    },
    methods: {
      contactUrl (host, str) {
        return host + str
      },
      saveModify () {
        axios({
          url: 'http://47.90.38.178:8080/wx_shop_test/manage/category/set_category_name.do',
          method: 'POST',
          params: {
            categoryId: this.categoryId,
            categoryName: this.categoryName
          }
        }).then(obj => {
          if (obj.data.status === 0) {
            console.log('x')
            this.productInfo = obj.data.data
            console.log(obj.data.list)
          }
        })
      }
    }
  }
</script>
<style>
.modifygoods{
  background: #fff;
}
  .goodsdetail-item{
    margin-top: 20px;
    text-align: left;
  }
  .goodsdetail-item .label{
    float: left;
    width: 120px;
    text-align: right;
    line-height: 33px;
    font-weight:bold;
    margin-right: 12px;
  }
  .goodsdetail-item .el-textarea,
  .goodsdetail-item .el-input,
  .goodsdetail-item .el-input-group--append,
  .goodsdetail-item .el-select{
    width: 300px;
    max-width: calc(100% - 140px);
  }
  .addmainImage{
    width: 56px;
    height: 56px;
    border:3px solid #e8e8e8;
    font-size: 48px;
    line-height: 56px;
    color: #ccc;
    text-align: center;
    float: left;
    cursor: pointer;
  }
  .modifygoods .editor{
    margin-left: 132px;
  }
  .panel-header .postbtn{
    margin-top: -10px;
   }
</style>
